/*
 * UnitBar.cpp
 *
 *  Created on: 19.2.2013
 *      Author: Travis
 */

#ifdef _WIN32 
#include <windows.h> 
#endif

#include "UnitBar.h"

namespace GameLogic
{

Gadgets::Form *unitBar;

void initUnitBar()
{
	unitBar = new Gadgets::Form(800, 64);
	unitBar->setBackground("background.png");
	unitBar->setPos(
			glm::vec2(Engine::screenSettings.screenWidth / 2 - 400,
					Engine::screenSettings.screenHeight - 64));
}

void insertUnitInBar(Gadgets::Form *u)
{
	if (u != NULL)
	{
		unitBar->deleteItems();
		u->setPos(glm::vec2(5, 0));

		unitBar->addItem(u);

	}
}

void deleteItemsUnitBar()
{
	unitBar->deleteItems();
}

void drawUnitBar()
{
	/*int mx, my;
	 SDL_GetMouseState(&mx, &my);
	 unitBar->setPos(glm::vec2(mx, my));*/
	unitBar->draw();
}

void setVisibleUnitBar(bool visible)
{
	unitBar->setVisible(visible);
}

void controlUnitBar(SDL_Event *event)
{
	unitBar->control(event);
}

} /* namespace gameLogic */
